package com.itheima.leyou.controller;

import com.itheima.leyou.service.StorageService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
public class StorageController {

    @Resource
    private StorageService storageService;

    @RequestMapping(value = "/getStorageQuanty/{sku_id}")
    public Map<String, Object> getStorageQuanty(@PathVariable("sku_id") String sku_id){
        return storageService.getStorageQuanty(sku_id);
    }

    @RequestMapping(value = "/insertStorage/{warehouse_id}/{sku_id}/{inquanty}/{outquanty}")
    public Map<String, Object> insertStorage(@PathVariable("warehouse_id") Integer warehouse_id, @PathVariable("sku_id") String sku_id,
                                 @PathVariable("inquanty") double inquanty, @PathVariable("outquanty") double outquanty){
        return storageService.insertStorage(warehouse_id, sku_id, inquanty, outquanty);
    }
}
